package layer
{
	/**
	 * @author kings
	 * @E-mail: qywangweiqiang@126.com
	 * 2012-12-2上午12:48:14
	 * */
	import fl.controls.TextInput;
	import fl.controls.listClasses.CellRenderer;

	import flash.events.KeyboardEvent;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.ui.Keyboard;

	public class LayerRenderer extends CellRenderer
	{
		private var isInit:Boolean=false;
		private var layerNameText:TextInput=new TextInput();

		public function LayerRenderer()
		{
			super();
			addChild(layerNameText);
			mouseChildren=true;
			layerNameText.addEventListener(KeyboardEvent.KEY_DOWN, textKeyBoardHandle);
		}

		private function textKeyBoardHandle(e:KeyboardEvent):void
		{
			if (e.keyCode==Keyboard.ENTER)
			{
				_data["LayerRenderer"]["name"]=layerNameText.text;
			}
		}

		override public function set data(v:Object):void
		{
			super.data=v;
			_data=v;
			if (!isInit)
			{
				isInit=true;
				layerNameText.text=v["LayerRenderer"]["name"]
			}
		}

	}

	//end class
}
